package com.challenge.util;

import com.challenge.App;

import java.io.*;

public class JsonUtil {

    /**
     * @return
     */
    public static String readJsonFile(String fileName) {
        String jsonStr = "";
        try {
            InputStream inputStream = App.class.getClassLoader().getResourceAsStream(fileName);
            BufferedReader br=new BufferedReader(new InputStreamReader(inputStream,"UTF-8"));
            StringBuffer sb = new StringBuffer();

            String str = null;
            while((str=br.readLine())!=null){
                sb.append(str);
            }

            br.close();
            jsonStr = sb.toString();
            return jsonStr;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}
